package hijava;

public class ProducerRunnable implements Runnable {
    private Storage15 storage;
    private boolean sw = true;

    public ProducerRunnable(Storage15 storage) {
        this.storage = storage;
    }
    public void run() {
        while (sw){
            storage.add();
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public void close(){
        this.sw = false;
    }
}
